<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>CANopenNode: TIME</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">CANopenNode
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__CO__TIME.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#files">Files</a> &#124;
<a href="#nested-classes">Data Structures</a> &#124;
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">TIME<div class="ingroups"><a class="el" href="group__CO__CANopen__301.html">CANopen_301</a></div></div>  </div>
</div><!--header-->
<div class="contents">

<p>CANopen Time-stamp protocol.  
<a href="#details">More...</a></p>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="files"></a>
Files</h2></td></tr>
<tr class="memitem:CO__TIME_8h"><td class="memItemLeft" align="right" valign="top">file &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="CO__TIME_8h.html">CO_TIME.h</a></td></tr>
<tr class="memdesc:CO__TIME_8h"><td class="mdescLeft">&#160;</td><td class="mdescRight">CANopen Time-stamp protocol. <br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="nested-classes"></a>
Data Structures</h2></td></tr>
<tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct &#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="structCO__TIME__t.html">CO_TIME_t</a></td></tr>
<tr class="memdesc:"><td class="mdescLeft">&#160;</td><td class="mdescRight">TIME producer and consumer object.  <a href="structCO__TIME__t.html#details">More...</a><br /></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga9e02651c1662d3da13a9a071c73347bb"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__CO__driver.html#ga1cb2d3466eb0c6d267f3b5ff1a0d9532">CO_ReturnError_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CO__TIME.html#ga9e02651c1662d3da13a9a071c73347bb">CO_TIME_init</a> (<a class="el" href="structCO__TIME__t.html">CO_TIME_t</a> *TIME, <a class="el" href="structCO__EM__t.html">CO_EM_t</a> *em, <a class="el" href="structCO__SDO__t.html">CO_SDO_t</a> *SDO, <a class="el" href="group__CO__NMT__Heartbeat.html#ga1e8c2a6c0fd4a33183503d25a7c6d744">CO_NMT_internalState_t</a> *operatingState, <a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a> COB_ID_TIMEMessage, <a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a> TIMECyclePeriod, <a class="el" href="structCO__CANmodule__t.html">CO_CANmodule_t</a> *CANdevRx, <a class="el" href="group__CO__dataTypes.html#ga1f1825b69244eb3ad2c7165ddc99c956">uint16_t</a> CANdevRxIdx, <a class="el" href="structCO__CANmodule__t.html">CO_CANmodule_t</a> *CANdevTx, <a class="el" href="group__CO__dataTypes.html#ga1f1825b69244eb3ad2c7165ddc99c956">uint16_t</a> CANdevTxIdx)</td></tr>
<tr class="memdesc:ga9e02651c1662d3da13a9a071c73347bb"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize TIME object.  <a href="#ga9e02651c1662d3da13a9a071c73347bb">More...</a><br /></td></tr>
<tr class="separator:ga9e02651c1662d3da13a9a071c73347bb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gae2f03663f1477cdc551b61cf5689cd6b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CO__TIME.html#gae2f03663f1477cdc551b61cf5689cd6b">CO_TIME_initCallbackPre</a> (<a class="el" href="structCO__TIME__t.html">CO_TIME_t</a> *TIME, void *object, void(*pFunctSignalPre)(void *object))</td></tr>
<tr class="memdesc:gae2f03663f1477cdc551b61cf5689cd6b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Initialize TIME callback function.  <a href="#gae2f03663f1477cdc551b61cf5689cd6b">More...</a><br /></td></tr>
<tr class="separator:gae2f03663f1477cdc551b61cf5689cd6b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga39f71192db2b40da6dcf8f4fceac9bb6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__CO__dataTypes.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__CO__TIME.html#ga39f71192db2b40da6dcf8f4fceac9bb6">CO_TIME_process</a> (<a class="el" href="structCO__TIME__t.html">CO_TIME_t</a> *TIME, <a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a> timeDifference_us)</td></tr>
<tr class="memdesc:ga39f71192db2b40da6dcf8f4fceac9bb6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Process TIME communication.  <a href="#ga39f71192db2b40da6dcf8f4fceac9bb6">More...</a><br /></td></tr>
<tr class="separator:ga39f71192db2b40da6dcf8f4fceac9bb6"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<p>CANopen Time-stamp protocol. </p>
<p>For CAN identifier see <a class="el" href="group__CO__driver.html#ga01dd35ae53fd2209ceccabdc8bf8dd06" title="Default CANopen identifiers. ">CO_Default_CAN_ID_t</a></p>
<p>TIME message is used for time synchronization of the nodes on network. One node should be TIME producer, others can be TIME consumers. This is configured with COB_ID_TIME object 0x1012 :</p>
<ul>
<li>bit 31 should be set for a consumer</li>
<li>bit 30 should be set for a producer</li>
</ul>
<h3>TIME CONSUMER</h3>
<p><a class="el" href="group__CO__TIME.html#ga9e02651c1662d3da13a9a071c73347bb" title="Initialize TIME object. ">CO_TIME_init()</a> configuration :</p><ul>
<li>COB_ID_TIME : 0x80000100L -&gt; TIME consumer with TIME_COB_ID = 0x100</li>
<li>TIMECyclePeriod :<ul>
<li>0 -&gt; no EMCY will be transmitted in case of TIME timeout</li>
<li>X -&gt; an EMCY will be transmitted in case of TIME timeout (X * 1.5) ms</li>
</ul>
</li>
</ul>
<p>Latest time value is stored in <code>CO-&gt;TIME-&gt;Time</code> variable.</p>
<h3>TIME PRODUCER</h3>
<p><a class="el" href="group__CO__TIME.html#ga9e02651c1662d3da13a9a071c73347bb" title="Initialize TIME object. ">CO_TIME_init()</a> configuration :</p><ul>
<li>COB_ID_TIME : 0x40000100L -&gt; TIME producer with TIME_COB_ID = 0x100</li>
<li>TIMECyclePeriod : Time transmit period in ms</li>
</ul>
<p>Write time value in <code>CO-&gt;TIME-&gt;Time</code> variable, this will be sent at TIMECyclePeriod. </p>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga9e02651c1662d3da13a9a071c73347bb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9e02651c1662d3da13a9a071c73347bb">&#9670;&nbsp;</a></span>CO_TIME_init()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__CO__driver.html#ga1cb2d3466eb0c6d267f3b5ff1a0d9532">CO_ReturnError_t</a> CO_TIME_init </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structCO__TIME__t.html">CO_TIME_t</a> *&#160;</td>
          <td class="paramname"><em>TIME</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structCO__EM__t.html">CO_EM_t</a> *&#160;</td>
          <td class="paramname"><em>em</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structCO__SDO__t.html">CO_SDO_t</a> *&#160;</td>
          <td class="paramname"><em>SDO</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__NMT__Heartbeat.html#ga1e8c2a6c0fd4a33183503d25a7c6d744">CO_NMT_internalState_t</a> *&#160;</td>
          <td class="paramname"><em>operatingState</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a>&#160;</td>
          <td class="paramname"><em>COB_ID_TIMEMessage</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a>&#160;</td>
          <td class="paramname"><em>TIMECyclePeriod</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structCO__CANmodule__t.html">CO_CANmodule_t</a> *&#160;</td>
          <td class="paramname"><em>CANdevRx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#ga1f1825b69244eb3ad2c7165ddc99c956">uint16_t</a>&#160;</td>
          <td class="paramname"><em>CANdevRxIdx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="structCO__CANmodule__t.html">CO_CANmodule_t</a> *&#160;</td>
          <td class="paramname"><em>CANdevTx</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#ga1f1825b69244eb3ad2c7165ddc99c956">uint16_t</a>&#160;</td>
          <td class="paramname"><em>CANdevTxIdx</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize TIME object. </p>
<p>Function must be called in the communication reset section.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">TIME</td><td>This object will be initialized. </td></tr>
    <tr><td class="paramname">em</td><td>Emergency object. </td></tr>
    <tr><td class="paramname">SDO</td><td>SDO server object. </td></tr>
    <tr><td class="paramname">operatingState</td><td>Pointer to variable indicating CANopen device NMT internal state. </td></tr>
    <tr><td class="paramname">COB_ID_TIMEMessage</td><td>Should be intialized with CO_CAN_ID_TIME_STAMP </td></tr>
    <tr><td class="paramname">TIMECyclePeriod</td><td>TIME period in ms (may also be used in consumer mode for timeout detection (1.5x period)). </td></tr>
    <tr><td class="paramname">CANdevRx</td><td>CAN device for TIME reception. </td></tr>
    <tr><td class="paramname">CANdevRxIdx</td><td>Index of receive buffer in the above CAN device. </td></tr>
    <tr><td class="paramname">CANdevTx</td><td>CAN device for TIME transmission. </td></tr>
    <tr><td class="paramname">CANdevTxIdx</td><td>Index of transmit buffer in the above CAN device.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd><a class="el" href="group__CO__driver.html#ga1cb2d3466eb0c6d267f3b5ff1a0d9532" title="Return values of some CANopen functions. ">CO_ReturnError_t</a>: CO_ERROR_NO or CO_ERROR_ILLEGAL_ARGUMENT. </dd></dl>

</div>
</div>
<a id="gae2f03663f1477cdc551b61cf5689cd6b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gae2f03663f1477cdc551b61cf5689cd6b">&#9670;&nbsp;</a></span>CO_TIME_initCallbackPre()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void CO_TIME_initCallbackPre </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structCO__TIME__t.html">CO_TIME_t</a> *&#160;</td>
          <td class="paramname"><em>TIME</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void *&#160;</td>
          <td class="paramname"><em>object</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">void(*)(void *object)&#160;</td>
          <td class="paramname"><em>pFunctSignalPre</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Initialize TIME callback function. </p>
<p>Function initializes optional callback function, which should immediately start processing of <a class="el" href="group__CO__TIME.html#ga39f71192db2b40da6dcf8f4fceac9bb6" title="Process TIME communication. ">CO_TIME_process()</a> function. Callback is called after TIME message is received from the CAN bus.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">TIME</td><td>This object. </td></tr>
    <tr><td class="paramname">object</td><td>Pointer to object, which will be passed to pFunctSignalPre(). Can be NULL </td></tr>
    <tr><td class="paramname">pFunctSignalPre</td><td>Pointer to the callback function. Not called if NULL. </td></tr>
  </table>
  </dd>
</dl>

</div>
</div>
<a id="ga39f71192db2b40da6dcf8f4fceac9bb6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga39f71192db2b40da6dcf8f4fceac9bb6">&#9670;&nbsp;</a></span>CO_TIME_process()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__CO__dataTypes.html#gaba7bc1797add20fe3efdf37ced1182c5">uint8_t</a> CO_TIME_process </td>
          <td>(</td>
          <td class="paramtype"><a class="el" href="structCO__TIME__t.html">CO_TIME_t</a> *&#160;</td>
          <td class="paramname"><em>TIME</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype"><a class="el" href="group__CO__dataTypes.html#ga33594304e786b158f3fb30289278f5af">uint32_t</a>&#160;</td>
          <td class="paramname"><em>timeDifference_us</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Process TIME communication. </p>
<p>Function must be called cyclically.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">TIME</td><td>This object. </td></tr>
    <tr><td class="paramname">timeDifference_us</td><td>Time difference from previous function call in [microseconds].</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>0: No special meaning. </dd>
<dd>
1: New TIME message recently received (consumer) / transmited (producer). </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="footer">Generated on Tue Jun 9 2020 17:29:32 for CANopenNode by
    <a href="http://www.doxygen.org/index.html">
    <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  </ul>
</div>
</body>
</html>
